package com.yjd.comm.spread.service;

import java.util.Map;

import com.yjd.comm.base.enums.DbWREnums;
import com.yjd.comm.base.model.PagerModel;
import com.yjd.comm.base.service.IBaseService;
import com.yjd.comm.spread.model.SpreaderModel;
import com.yjd.comm.user.model.UserModel;

/**
 * <b>description</b>：人人推广员表业务接口<br>
 * <b>time</b>：2015-10-09 15:01:09 <br>
 * <b>author</b>：  SongJian
 */
public interface ISpreaderService extends IBaseService {
	/**
	 * 插入
	 * 
	 * @param model
	 * @return
	 * @throws Exception
	 */
	public SpreaderModel insert(SpreaderModel model) throws Exception;

	/**
	 * 更新,大于等于1表示成功，其他失败
	 * 
	 * @param model
	 * @return
	 * @throws Exception
	 */
	public int update(SpreaderModel model) throws Exception;

	/**
	 * 根据id删除,大于等于1表示成功，其他失败
	 * 
	 * @param id
	 * @return
	 * @throws Exception
	 */
	public int delete(Long id) throws Exception;
	
	/**
	 * <!--推广会员人数-->
	 * @param param  推广员的id user_id 
	 * @return
	 * @throws Exception
	 */
	int countSpreadRegister(Map param) throws Exception;
	/**
	 * <!--充值会员人数-->
	 * @param param  推广员的id spreader
	 * @return
	 * @throws Exception
	 */
	int countSpreadOrder(Map param) throws Exception;
	/**
	 * <!--充值金额总额-->
	 * @param param  推广员的id spreader
	 * @return
	 * @throws Exception
	 */
	double sumSpreadOrder(Map param) throws Exception;
	/**
	 * <!--投资会员人数-->
	 * @param param  推广员的id spreader
	 * @return
	 * @throws Exception
	 */
	int countSpreadInvester(Map param) throws Exception;
	/**
	 * <!--投资金额-->
	 * @param param  推广员的id spreader
	 * @return
	 * @throws Exception
	 */
	double sumSpreadInvester(Map param) throws Exception;
	/**
	 * 收益次数
	 * @param param
	 * 0未领取,1已领取   	reward_status
	 * 推广人id			spreader      
	 * @return
	 * @throws Exception
	 */
	int countReward(Map param) throws Exception;
	/**
	 * 收益总额
	 * @param param
	 * 0未领取,1已领取   	reward_status
	 * 推广人id			spreader    
	 * @return
	 * @throws Exception
	 */
	double sumReward(Map param) throws Exception;
	/**
	 * 推广详情分页
	 * @param paramMap
	 * @return
	 * @throws Exception
	 */
	public PagerModel getSpreadDetailPage(Map paramMap) throws Exception ;
	
	void incrementSpreadCount(Map paramMap) throws Exception ;
	/**
	 * 设置2个用户的推广关系
	 * @param spreader
	 * @param regisiter
	 * @throws Exception
	 */
	void setSpreadRelation(Long spreader,Long regisiter) throws Exception ;
	/**
	 * 得到1条yjd_spreader 表的数据,与其他任何表无关
	 * @param paramMap
	 * @return
	 * @throws Exception
	 */
	public SpreaderModel getOneModeIndependent(Map paramMap,DbWREnums write) throws Exception;
	
}